﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UWP.Douban.Mvvm;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace UWP.Douban.Views
{
    public class BasePage:Page
    {
        public BasePage():base()
        {
            this.NavigationCacheMode = NavigationCacheMode.Enabled;
        }

        public Frame ThisMainPageFrame
        {
            get
            {
                return MainPage.Current.ThisScenarioFrame;
            }
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var vm = (BaseVm)DataContext;
            base.OnNavigatedTo(e);
            vm?.OnNavigatedTo(e, this);
        }


        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            var vm = (BaseVm)DataContext;
            base.OnNavigatedFrom(e);
            vm?.OnNavigatedForm(e);
        }
    }
}
